package com.gin.no_gay_alliance.database.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.gin.no_gay_alliance.database.entity.NgaAccount;

import java.util.List;

/**
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/8/1 17:43
 **/
@Dao
public interface NgaAccountDao {
    /**
     * 添加账号
     *
     * @param account 账号
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void add(NgaAccount account);

    @Delete
    int delete(NgaAccount account);

    @Query("delete from NgaAccount where userId=:userId ")
    int delete(long userId);

    @Update
    int update(NgaAccount account);

    @Query("SELECT * FROM NgaAccount")
    List<NgaAccount> listAll();
}
